<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div data-role="page" id="detail_page">
    <div data-role="header">
        <h1>ZHibogo</h1>
    </div>

    <div data-role="content">
        <div class="ui-field-contain" style="border-bottom: none;">
            <label for="board">게시판:</label>
            <select name="board" id="board" data-native-menu="false">
                <option value="newmovie" <c:if test="${detail.board eq 'newmovie'}">selected="selected"</c:if>>영화 - 최신 외국영화</option>
                <option value="oldmovie" <c:if test="${detail.board eq 'oldmovie'}">selected="selected"</c:if>>영화 - 지난 외국영화</option>
                <option value="kormovie" <c:if test="${detail.board eq 'kormovie'}">selected="selected"</c:if>>영화 - 한국 영화</option>
                <option value="hdmovie" <c:if test="${detail.board eq 'hdmovie'}">selected="selected"</c:if>>영화 - DVD 고화질 영화</option>
                <option value="3dmovie" <c:if test="${detail.board eq '3dmovie'}">selected="selected"</c:if>>영화 - 3D 영화</option>
                
                <option value="kdramaon" <c:if test="${detail.board eq 'kdramaon'}">selected="selected"</c:if>>한국 TV 프로그램 - 드라마(방영중)</option>
                <option value="kdramaover" <c:if test="${detail.board eq 'kdramaover'}">selected="selected"</c:if>>한국 TV 프로그램 - 드라마(종방)</option>
                <option value="kentertain" <c:if test="${detail.board eq 'kentertain'}">selected="selected"</c:if>>한국 TV 프로그램 - 쇼/오락/스포츠</option>
                <option value="ksocial" <c:if test="${detail.board eq 'ksocial'}">selected="selected"</c:if>>한국 TV 프로그램 - 시사/교양/다큐</option>
                <option value="kcut" <c:if test="${detail.board eq 'kcut'}">selected="selected"</c:if>>한국 TV 프로그램 - 분할/편집 영상</option>
                
                <option value="fdramaon" <c:if test="${detail.board eq 'fdramaon'}">selected="selected"</c:if>>외국 TV 프로그램 - 드라마(방영중)</option>
                <option value="fdramaover" <c:if test="${detail.board eq 'fdramaover'}">selected="selected"</c:if>>외국 TV 프로그램 - 드라마(종방)</option>
                <option value="fentertain" <c:if test="${detail.board eq 'fentertain'}">selected="selected"</c:if>>외국 TV 프로그램 - 오락 / 교양 / 다큐</option>
                
                <option value="mmovie" <c:if test="${detail.board eq 'mmovie'}">selected="selected"</c:if>>모바일 영상 - 영화</option>
                <option value="mktv" <c:if test="${detail.board eq 'mktv'}">selected="selected"</c:if>>모바일 영상 - 국내 TV 방송</option>
                <option value="mftv" <c:if test="${detail.board eq 'mftv'}">selected="selected"</c:if>>모바일 영상 - 외국 TV 방송</option>
                <option value="mani" <c:if test="${detail.board eq 'mani'}">selected="selected"</c:if>>모바일 영상 - 애니메이션</option>
                
                <option value="aniover" <c:if test="${detail.board eq 'aniover'}">selected="selected"</c:if>>애니메이션 - 종방</option>
                <option value="anion" <c:if test="${detail.board eq 'anion'}">selected="selected"</c:if>>애니메이션 - 방영중</option>
                
                <option value="torgame" <c:if test="${detail.board eq 'torgame'}">selected="selected"</c:if>>유아,아동용 - 게임</option>
                <option value="torbook" <c:if test="${detail.board eq 'torbook'}">selected="selected"</c:if>>유아,아동용 - 만화책, 소설</option>
                <option value="torutil" <c:if test="${detail.board eq 'torutil'}">selected="selected"</c:if>>유아,아동용 - 유틸리티, 강좌</option>
                
                <option value="kmp3" <c:if test="${detail.board eq 'kmp3'}">selected="selected"</c:if>>MP3 - 국내</option>
                <option value="fmp3" <c:if test="${detail.board eq 'fmp3'}">selected="selected"</c:if>>MP3 - 해외</option>
            </select>
        </div>
        
        <div class="ui-field-contain" style="border-bottom: none;">
            <label for="search" >검색 :</label>
            <select name="search" id="search" data-native-menu="false">
                <option value="subject" <c:if test="${detail.search eq 'subject'}">selected="selected"</c:if>>제목</option>
                <option value="user_name" <c:if test="${detail.search eq 'user_name'}">selected="selected"</c:if>>글쓴이</option>
                <option value="contents" <c:if test="${detail.search eq 'contents'}">selected="selected"</c:if>>내용</option>
            </select>
        </div>
        
        <div class="ui-field-contain" style="border-bottom: none;">
            <label for="keyword">검색어 :</label>
            <input type="text" data-clear-btn="true" name="keyword" id="keyword" value="<c:out value='${detail.keyword}'/>"/>
        </div>
        
        <div class="ui-field-contain" style="border-bottom: none;">
            <label for="startymd">이후 글 다운로드 :</label>
            <c:choose>
                <c:when test="${not empty detail.startymd}">
                    <c:set var="startymd" value="${detail.startymd}"/>
                </c:when>
                <c:otherwise>
                    <fmt:formatDate pattern='yyyy.MM.dd' value='<%=new java.util.Date()%>' var="startymd"/>
                </c:otherwise>
            </c:choose>
            <input type="text" data-role="date" name="startymd" id="startymd" data-date-format="yy.mm.dd" readonly="true" value="<c:out value='${startymd}'/>"/>
        </div>
        
        <div data-role="controlgroup" data-type="horizontal" align="right">
            <c:choose>
                <c:when test="${not empty detail.id}">
                    <button type="button" data-icon="delete" data-iconpos="left" data-inline="true" id="btn_remove" onclick="jQuery.mobile.changePage('zHibogo.do?method=remove', {type:'post', transition: 'slide', reverse: true, data:{id:'<c:out value="${detail.id}"/>'}});">삭제</button>
                    <button type="button" data-icon="check" data-iconpos="left" data-inline="true" id="btn_save" onclick="if($('#keyword').val() != ''){ jQuery.mobile.changePage('zHibogo.do?method=update', {type:'post', transition: 'slide', reverse: true, data:{id:'<c:out value="${detail.id}"/>', board:$('#board').val(), search:$('#search').val(), keyword:$('#keyword').val(), startymd:$('#startymd').val().replace(/\./g, '') }}); }else{ jQuery.mobile.changePage('login.do?method=errorDialog', {type:'post', transition: 'pop', role: 'dialog', data:{errorMessage:'키워드 필수입력~'}}); }">저장</button>
                </c:when>
                <c:otherwise>
                    <button type="button" data-icon="check" data-iconpos="left" data-inline="true" id="btn_save" onclick="if($('#keyword').val() != ''){ jQuery.mobile.changePage('zHibogo.do?method=insert', {type:'post', transition: 'slide', reverse: true, data:{board:$('#board').val(), search:$('#search').val(), keyword:$('#keyword').val(), startymd:$('#startymd').val().replace(/\./g, '') }}); }else{ jQuery.mobile.changePage('login.do?method=errorDialog', {type:'post', transition: 'pop', role: 'dialog', data:{errorMessage:'키워드 필수입력~'}}); }">저장</button>
                </c:otherwise>
            </c:choose>
            <button type="button" data-icon="back" data-iconpos="left" data-inline="true" id="btn_list" onclick="jQuery.mobile.changePage('zHibogo.do?method=list', {type:'post', transition: 'slide', reverse: true});">리스트</button>
        </div>
        
    </div>
</div>